package com.cassio.guarapari.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

@Entity
@NamedQueries({ @NamedQuery(name = "Imovel.findAll", query = "SELECT i FROM Imovel i") })
public class Imovel implements Serializable {

	private static final long serialVersionUID = -722461756165228810L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	private Long capacidade;
	
	@Embedded
	private Endereco endereco = new Endereco();

	@OneToMany(mappedBy = "imovel")
	private List<Locacao> locacoes;

	@OneToMany(mappedBy = "imovel")
	private List<Preco> precos;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getCapacidade() {
		return capacidade;
	}

	public void setCapacidade(Long capacidade) {
		this.capacidade = capacidade;
	}
	
	public Endereco getEndereco() {
		return endereco;
	}
	
	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
	}

	public List<Locacao> getLocacoes() {
		return locacoes == null ? new ArrayList<Locacao>() : locacoes;
	}

	public List<Preco> getPrecos() {
		return precos == null ? new ArrayList<Preco>() : precos;
	}
}
